package com.xiaozhaovip.demo.Enum;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * 活动状态的分类
 *
 * @author Cauli
 */

@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum YueQiLaiActivityStatusEnum {
    SignUpNow(1, "报名中"),
    SignUpActivityClosed(2, "活动报名结束"),
    QuotaFull(3, "名额已满"),
    ActivityInProgress(4, "活动进行中"),
    ActivityEnd(5, "活动结束"),
    CancelActivity(6, "人数未满，活动已自动取消");

    private int id;
    private String name;

    /**
     * 通过 id 得到活动状态
     *
     * @param id
     * @return
     */
    public static YueQiLaiActivityStatusEnum getById(int id) {
        for (YueQiLaiActivityStatusEnum activityStatusEnum : YueQiLaiActivityStatusEnum.values()) {
            if (id == activityStatusEnum.id) {
                return activityStatusEnum;
            }
        }
        return null;
    }
}
